{{ baselayout.dockerStage() }}

{{ docker.from(user="guywithnose", image="solr", tag="4.10.4") }}

{{ docker.version() }}

{{ environment.general() }}

USER root

COPY ./solr/ /tmp/solr

{{ baselayout.copy() }}

RUN pacman --sync --noconfirm --noprogressbar --quiet net-tools \
    && rm -rf /opt/solr/server \
    && mv /opt/solr/example/ /opt/solr/server/ \
    && rm -rf /opt/solr/server/solr \
    && mv /tmp/solr /opt/solr/server/solr \
    && mkdir -p /opt/solr/server/solr/typo3lib \
    && curl -sf -o /opt/solr/server/solr/typo3lib/solr-typo3-plugin.jar -L https://github.com/TYPO3-Solr/solr-typo3-plugin/releases/download/release-1_3_0/solr-typo3-plugin-1.3.0.jar \
    && ln -s /opt/solr/contrib /opt/solr/server/solr/contrib \
    && mkdir -p /opt/solr/server/solr/data \
    && ln -s /opt/solr/server/solr/data /opt/solr/server/solr/typo3cores/data \
    && chown -R solr:solr /opt/solr/server/solr/

USER solr

WORKDIR /opt/solr/server

VOLUME ["/opt/solr/server/solr/data"]
